home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / DClap / DApplication.h < prev    next >
Encoding:
Text File  |  1996-07-05  |  3.1 KB  |  94 lines  |  [TEXT/R*ch]

  1. // DApplication.h
  2. // d.g.gilbert
  3.  
  4. #ifndef _DAPPLICATION_
  5. #define _DAPPLICATION_
  6.  
  7. #include "DTaskMaster.h"
  8.  
  9. class DWindow;
  10. class DMenu;
  11. class DFile;
  12.  
  13. class DApplication : public DTaskMaster
  14. {    
  15. public:
  16.     enum filetasks {cFileMenu=40, kAbout,kNew,kOpen,kClose,kSave,kSaveAs,kSaveACopy,
  17.                     kPrint,kHelp,kQuit,kOpenAFile, kPrintAFile};
  18.     enum edittasks {cEditMenu=60, kUndo,kCut,kCopy,kPaste,kClear,kSelectAll,
  19.                     kShowClipboard, kFind,kFindAgain};
  20.     enum windowtasks {cWindowMenu= 80, kPrevWindow,kNextWindow,kChooseWindow,
  21.                     kDeleteDeadWindow};
  22.     
  23.     static char* kName;
  24.     static char* kVersion;
  25.     static char* kHelpfolder;
  26.     static Nlm_RecT    fgAppWinRect;
  27.     static short HandleSpecialEvent( long inEvent, long outReply, long inNumber);
  28.     
  29.     Boolean fDone;                                // true when Quit requested...
  30.     Boolean fDidOpenStartDoc;
  31.     char* fPathname;
  32.     char* fShortname;
  33.     char* fAboutLine;
  34.     DWindow* fAppWindow;
  35.     char*    fAcceptableFileTypes;    // mac, ?? other file type ids
  36.     char*    fFileSuffix;                    // unix, msdos file suffix
  37.     char*    fAppID;                // == processnum or the like, use as unique id value for process
  38.     
  39.     DApplication();
  40.     ~DApplication();    
  41.     void IApplication(const char* theAppName = NULL);
  42.     
  43.     virtual void    Run(void);
  44.     virtual void    MainEventLoop(void);
  45.     virtual void    ProcessTasks(void);
  46.     //virtual void    Idle(EventRecord *macEvent);
  47.     virtual    void    Quit(void);
  48.     virtual const char* AppID() { return fAppID; }
  49.     
  50.     virtual const char*    Pathname(void);
  51.     virtual const char*    Shortname(void);
  52.  
  53.     virtual Boolean IsMyAction(DTaskMaster* action); // override 
  54.     virtual Boolean    DoMenuTask( long tasknum, DTask* theTask);
  55.     virtual DMenu*  NewMenu(long id, char* title);
  56.     virtual void    UpdateMenus(void);
  57.     virtual void    SetUpMenus(void);
  58.     virtual void  SetUpMenu(short menuId, DMenu*& aMenu); 
  59.     virtual void    DoAboutBox(void);
  60.     virtual void     DoHelp(void);
  61.     virtual void  OpenHelp(DFile* aFile);
  62.     virtual void  OpenHelp(const char* helpname);
  63.     virtual void    SetAppMenuWindow(DWindow* itsWindow);
  64.  
  65.     virtual void  InitSpecialEvents();  // == AppleEvents for Mac
  66.  
  67.     virtual char*    GetPref(char* type, char* section = "general", char* defaultvalue = NULL);
  68.     virtual long    GetPrefVal(char* type, char* section = "general", char* defaultvalue = NULL);
  69.     virtual char*    GetPrefSection(char* section, ulong& sectlen, char* defaultvalue = NULL);
  70.     virtual char* GetFilePref(char* type, char* section = "general", char* defaultvalue = NULL);
  71.     virtual char* ConvertStdFilePath(char* pathname);
  72.     
  73.     virtual Boolean SetPref(char* prefvalue, char* type, char* section = "general");
  74.     virtual Boolean SetPref(long prefvalue, char* type, char* section = "general");
  75.     virtual Boolean InstallDefaultPrefs(const char* defaultSuffix= ".prefs", const char* appName= NULL); // use appName==ShortName()
  76.     
  77.     virtual    Boolean ChooseFile(DFile*& openedFile, char* filesuffix, char* acceptableTypeIDs);
  78.     virtual void OpenDocument(DFile* aFile);
  79.     virtual void OpenDocument(char* pathname);
  80.     virtual Boolean GotStartDocs();
  81.     virtual Boolean OpenStartDocs();
  82.     
  83.         // should these be integrated w/ DTaskMaster/DTaskCentral, as TasksAvail() ????
  84.     Boolean    EventsAvail();
  85.     void    FlushEvents();
  86.  
  87. };
  88.  
  89.  
  90. extern DApplication* gApplication;        // the current application object
  91.  
  92.  
  93. #endif
  94.